<?php
ob_start();
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
include '../../operations/connection.php';

$iddept = $_REQUEST['iddept'];
$newlang = $_REQUEST['newlang'];

if ($_REQUEST['newlang'] == "EN") {
	include "../../value/value_en.php";
} else if($_REQUEST['newlang'] == "VN") {
	include "../../value/value_vn.php";
}
else {
	include "../../value/value_kr.php";
}

$sqldept = mysql_query("SELECT dl.DepartmentName,dl.Location,dl.Description FROM department_lang dl
                      WHERE dl.IDDepartment = '$iddept' AND dl.LangID='".$_SESSION['lang']."'");
$ros = mysql_fetch_assoc($sqldept);

?>
<script type="text/javascript">
$(function() {
	$(".tree").treeview({
		collapsed: true,
		animated: "medium",
		control:"#sidetreecontrol",
		persist: "location"
	});
})
</script>

<form action="admin/employeemanagement/process-update-dept.php" method="post" >
				<input type="hidden" id="iddeptment" name="iddeptment" value="<?=$iddept?>">
				<table border="0" cellpadding="0" cellspacing="5">
					<tr>
						<td width="150"> <?php echo $l_dept?> : <span style="color: red">*</span></td>
						<td><input type="text" class="indepart" id="deptname" name="deptname"
							value="<?php echo $ros[DepartmentName]?>" /></td>
					</tr>
					<?php if ($ros[Location]=="" || $ros[Location]=='Unknown'){?>
					<tr>
						<td width="150"><span></span> <?php echo $l_location?> :</td>
						<td><input type="text" class="indepart" id="locationdept" name="locationdept" 
						onblur="if(this.value==''){this.value='Unknown'}" onfocus="if(this.value=='Unknown'){this.value=''};"
							value="Unknown" /></td>
					</tr>
					<?php }else{?>
					<tr>
						<td width="150"><span></span> <?php echo $l_location?> :</td>
						<td><input type="text" class="indepart" id="locationdept" name="locationdept" 
							value="<?php echo $ros[Location]?>" /></td>
					</tr>
					<?php }?>
					
					<?php if ($ros[Description]=="" || $ros[Description]=="Unknown"){?>
					<tr>
						<td width="150"><span></span> <?php echo $l_description?> :</td>
						<td><input type="text" class="indepart" id="descriptiondept" name="descriptiondept"
						onblur="if(this.value==''){this.value='Unknown'}" onfocus="if(this.value=='Unknown'){this.value=''};"
							value="Unknown" /></td>
					</tr>
					<?php }else {?>
					<tr>
						<td width="150"><span></span> <?php echo $l_description?> :</td>
						<td><input type="text" class="indepart" id="descriptiondept" name="descriptiondept"
							value="<?php echo $ros[Description]?>" /></td>
					</tr>
					<?php }?>
				</table>
				<div style="width: 360px; margin-top: 20px; text-align: center">
					<input type="submit" value="<?php echo $l_register?>" class="btndepartdisable" id="registerdept" name="registerdept"/> 
					<input type="submit" value="<?php echo $l_update?>" class="btndepart" name="updatedept" id="updatedept"/> 
					<input type="button" value="<?php echo $l_reset?>" class="btndepart" onclick="resetChildDept();" id="resetdept" name="resetdept"/> 
					<input type="submit" value="<?php echo $l_delete?>" class="btndepart" id="deletedept" name="deletedept"/>
				</div>
</form>